﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    x:Class="Wp7LLS.MainPage"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <phone:PhoneApplicationPage.Resources>
        
        <DataTemplate x:Key="ItemTemplate">
            <StackPanel>
                <TextBlock FontSize="25" Text="{Binding OwnerName}" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="GroupItemHeaderTemplate">
            <Border Background="Transparent" Padding="5">
                <Border Background="{StaticResource PhoneAccentBrush}" BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="2" Width="62" 
         Height="62" Margin="0,0,18,0" HorizontalAlignment="Left">
                    <TextBlock Text="{Binding Key}" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="48" Padding="6" 
            FontFamily="{StaticResource PhoneFontFamilySemiLight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </Border>
            </Border>

        </DataTemplate>
       
        <DataTemplate x:Key="groupItemHeader">
            <Border Background="{Binding Converter={StaticResource GroupBackground}}" 
                                    Width="99" Height="99" Margin="6" IsHitTestVisible="{Binding HasItems}">
                <TextBlock Text="{Binding Key}" 
                                           FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                           FontSize="48"
                                           Margin="8,0,0,0"
                                           Foreground="{Binding Converter={StaticResource GroupForeground}}"                                        
                                           VerticalAlignment="Bottom"/>
                
            </Border>
        </DataTemplate>                

        <ItemsPanelTemplate x:Key="GroupItemsPanel">
            <toolkit:WrapPanel ItemHeight="105" ItemWidth="105"></toolkit:WrapPanel>
        </ItemsPanelTemplate>

        
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Wp7 LLS Demo" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="accents" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <toolkit:LongListSelector
        		x:Name="FeedList"
        		IsFlatList="False"
                DisplayAllGroups="False"
        		DataContext="{Binding Source={StaticResource LongListSelectorData}}"
        		ItemsSource="{Binding DataSource}" 
        		ItemTemplate="{StaticResource ItemTemplate}" 
        		GroupHeaderTemplate="{StaticResource GroupItemHeaderTemplate}" 
                GroupItemTemplate="{StaticResource groupItemHeader}"
                GroupItemsPanel="{StaticResource GroupItemsPanel}"                
                />
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>